<template>
  <div class="xiangding-video">
    <div class="xiangding-video-box" v-if="videoFiles && videoFiles.length">
      <div class="video-swiper">
        <el-carousel :autoplay="false" arrow="always" height="100%" @change="hanldeChange">
          <el-carousel-item v-for="item in videoFiles" :key="item.id">
            <VideoPlayer
              :src="item.filePath ? item.filePath.replace('/file/maneuver-scenario/','maneuver-scenario-files/') : ''"
              cover_url
            />
          </el-carousel-item>
        </el-carousel>
      </div>
      <div class="title">{{ videoFiles[activeIndex].fileName }}</div>
    </div>
    <el-empty v-else description="暂无想定视频" :image-size="100"></el-empty>
  </div>
</template>

<script>
import VideoPlayer from "@/components/video-player";
export default {
  props: ["detail"],
  components: { VideoPlayer },
  computed: {
    videoFiles() {
      if (this.detail && this.detail.videoFiles) {
        return this.detail.videoFiles;
      } else {
        return [];
      }
    },
  },
  data() {
    return {
      activeIndex: 0,
    };
  },
  methods: {
    hanldeChange(index1, index2) {
      this.activeIndex = index1;
    },
  },
};
</script>

<style lang="less">
.xiangding-video {
  height: 100%;
  position: relative;
  .xiangding-video-box {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .video-swiper {
    width: 69%;
    margin: 0 auto;
    height: 51.5%;
    .el-carousel {
      width: 100%;
      height: 100%;
    }
  }
  .title {
    width: 69%;
    height: 64px;
    background: #e6e8f0;
    font-size: 16px;
    text-align: center;
    font-weight: 400;
    color: #333333;
    line-height: 64px;
    z-index: 99;
    pointer-events: auto;
  }
  .el-empty {

    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
  }
}
</style>
